/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var theSitetree=[ 
	['PAGE','8901',jdecode('Harmony+Information'),jdecode(''),'/8901.html','true',[],''],
	['PAGE','9301',jdecode('Warron%26%23x27%3Bs+Wisdom'),jdecode(''),'/9301.html','true',[],''],
	['PAGE','9322',jdecode('Sweat+Lodge+%26+7+Lodges'),jdecode(''),'/9322.html','true',[],''],
	['PAGE','9601',jdecode('Native+%26+Spiritual+Items'),jdecode(''),'/9601.html','true',[],''],
	['PAGE','50101',jdecode('Woman%26%23x27%3Bs+Way'),jdecode(''),'/50101.html','true',[],''],
	['PAGE','9501',jdecode('Herbs%2C+Spices+and+Teas'),jdecode(''),'/9501.html','true',[],''],
	['PAGE','9401',jdecode('Natural+Health+Products+'),jdecode(''),'/9401.html','true',[],''],
	['PAGE','39401',jdecode('Handcrafted+Gifts'),jdecode(''),'/39401.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Simple';
theSitetree.paletteFamily='EAD8C1';
theSitetree.keyvisualId='4621';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='10346';
theSitetree.graphicsetId='10458';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='ead8c1';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Simple',
				paletteFamily: 	'EAD8C1',
				keyvisualId: 	'4621',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'10346',
				graphicsetId: 	'10458',
				contentColor: 	'000000',
				contentBGColor: 'ead8c1',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'857157',
				e_color: 		'FFFFFF',
				f_color: 		'817E7E',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8901',
internalId:  '',
customField: '20091106-174703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9301',
internalId:  '',
customField: '20090921-213032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9322',
internalId:  '',
customField: '20091106-185654'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9401',
internalId:  '',
customField: '20091106-193053'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '8901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9601',
internalId:  '',
customField: '20091106-190322'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9501',
internalId:  '',
customField: '20091106-190509'
};
webappMappings['1501']=webappMappings['1501-13362358']={
webappId:    '1501',
documentId:  '8901',
internalId:  '13362358',
customField: '1501'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '8901',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9301',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9322',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9601',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9401',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9501',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50101',
internalId:  '',
customField: '20091027-111145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39401',
internalId:  '',
customField: '20090917-140442'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN28MS';
var companyName   = '+Harmony+Spirit%2C+Village+%26+Farm';
var htmlTitle	  = 'Harmony+Spirit+-+Village+%26+Farm';
var metaKeywords  = 'Harmony+Spirit%2C+Harmony+Village%2C+Shawnee%2C+Oklahoma%2C+sweat+lodge%2C+Mysts%2C+Oils%2C+spices%2C+herbs%2C+smudge%2C+sage%2C+7+Lodges%2C+Warron%2C+Debra+%2C+Big+Eagle%2C+eggs%2C+goat+milk+soap%2C+retreats%2C+readings%2C+ear+candle%2C+spiritual+advisor%2C+spiritual+speaker%2C+pastor%2C+motivational+speaker%2C+jewelry%2C+Native+american%2C+Cheyenne%2C+drums%2C+drumming%2C+medicine+bags%2C+dream+catchers%2C+herbal+pads%2C+eye+pillows%2C+cooking%2C+classes%2C+indian+supplies.';
var metaContents  = 'Harmony+Spirit+and+Harmony+Village+are+products+and+a+place+to+help+bring+you+peace+and+well+being+for+both+your+body+and+soul.';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};
